package com.fan.share.wxapi;


import android.content.Intent;
import android.widget.Toast;

import cn.sharesdk.wechat.utils.WXAppExtendObject;
import cn.sharesdk.wechat.utils.WXMediaMessage;
import cn.sharesdk.wechat.utils.WechatHandlerActivity;

/**
 * 微信分享回调
 *
 * @author fan
 */
public class WXEntryActivity extends WechatHandlerActivity {


    @Override
    public void onGetMessageFromWXReq ( WXMediaMessage msg ) {
        if ( msg != null ) {
            Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage( getPackageName() );
            startActivity( iLaunchMyself );
        }
    }


    @Override
    public void onShowMessageFromWXReq ( WXMediaMessage msg ) {
        if ( msg != null && msg.mediaObject != null
                && ( msg.mediaObject instanceof WXAppExtendObject ) ) {
            WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject;
            Toast.makeText( this, obj.extInfo, Toast.LENGTH_SHORT ).show();
        }
    }
}

